﻿using System;
using Jayden.Dll.Web.Enums;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;
using Jayden.Dll.Web.HtmlControls.Interfaces;

namespace Jayden.Dll.Web.HtmlControls
{
	public class Link: HtmlElement, WithHRef, WithType
	{
		public Link() : base(LinkDescription.Instance) { }
		public Link(string href, string rel = "stylesheet")
			: this()
		{
			if (href != null)
				HRef = href;
			if (rel != null)
				Rel = rel;
		}

		public string HRef { get { return this["href"]; } set { this["href"] = value; } }
		public string HRefLang { get { return this["hreflang"]; } set { this["hreflang"] = value; } }
		public string Media { get { return this["media"]; } set { this["media"] = value; } }
		public string Rel { get { return this["rel"]; } set { this["rel"] = value; } }
		public string Type { get { return this["type"]; } set { this["type"] = value; } }
		public string Sizes { get { return this["sizes"]; } set { this["sizes"] = value; } }
	}
	public class LinkDescription : HtmlElementDescription
	{
		public static readonly LinkDescription Instance = new LinkDescription();
		private LinkDescription() : base("link", HtmlVersion.Html4, false, false) { }
		public override Type ControlType { get { return typeof(Link); } }
		public override bool IsMetaDataElement { get { return true; } }
		public override string Description { get { return "metadata that expresses inter-document relationships."; } }
	}
}
